package com.lk.zuul.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @ClassName SecurityConfiguration
 * @Description
 * @Author liangkun
 * @Date 2019/4/8/008
 **/
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    public void configure(HttpSecurity http) throws Exception {

//        http
//                .authorizeRequests()
//                .anyRequest().authenticated()
//                .and()
//                .formLogin().and()
//                .httpBasic();
        http.formLogin()
                .and()
                .authorizeRequests()//请求授权
                .anyRequest()//任何请求
                .authenticated()//需要身份认证
        ;

    }
}
